home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcr / pcr4_4.lha / DIST / makefile.common < prev    next >
Makefile  |  1992-04-16  |  5KB  |  220 lines

  1. #
  2. # PCR common lower-level makefile
  3. #
  4. # Demers, December 1, 1989 4:14:56 pm PST
  5. # Alan Ishigo, January 9, 1989 1:05:51 pm PST
  6. #
  7.  
  8. #
  9. # The following variables are defined in makefile.config
  10. #     (This implies they are inherited from above, since makefile.config
  11. #       is build automatically)
  12. #
  13. # COMPONENT = name of this xr component
  14. #     (= name of this subdirectory, unless checked out)
  15. # CONFIG = name of configuration
  16. # MACHINE = -machine_name, e.g. -sparc
  17. #     (used to construct destination directory names)
  18. # STD_INCLUDES = where to get include files
  19. #     (e.g. -IINCLUDE -I../INCLUDE)
  20. # CONFIG_CFLAGS = configuration-specific flags for cc
  21. #     (these are folded into CFLAGS below).
  22. # CONFIG_AFLAGS = configuration-specific flags for as
  23. #     (these are folded into AFLAGS below).
  24. # VERSION = version_bounce, without quotes; e.g. 1_5
  25.  
  26. CONFIG_DIR = ${CONFIG}${MACHINE}
  27.  
  28. VERSION_DOT_O = ${COMPONENT}Version.o
  29. VERSION_DOT_C = ${COMPONENT}Version.c
  30. VERSION_STRING_NAME = XR_${COMPONENT}Version
  31.  
  32. STD_INCLUDES = -IINCLUDE -I../INCLUDE
  33. # The following may fail on non-Sun makes, sigh ...
  34. CFLAGS += ${STD_INCLUDES} ${CONFIG_CFLAGS} ${MACHINE}
  35. AFLAGS = ${STD_INCLUDES} ${CONFIG_AFLAGS} ${MACHINE}
  36.  
  37. # The following must correspond to ${UTILITIES_DIR}/${CPDIFF} in makefile
  38. CPDIFF = ../../UTILITIES/copyifdifferent
  39.  
  40. #
  41. # The following variables should be defined in the local makefile (i.e.
  42. #   the makefile that #include's this one).  They can be empty:
  43. #
  44. # INCLUDE = header files associated with this component
  45. # BIN = public commands (to be put into ../BIN/$CONFIG_DIR)
  46. # OBJ = semi-public .o files (to be put into ../LIB/$CONFIG_DIR/xr.a)
  47. # LIBA = public library objects (to be put into ../LIB/$CONFIG_DIR/libxr.a)
  48. # LIB = public objects (to be put into ../LIB/$CONFIG_DIR/)
  49. # MAN = manual entries
  50. # MAKE_DEPEND_SRC = sources to be considered by "make depend"
  51. # CLEANUPFILES = other files to remove in a make clean
  52. #
  53.  
  54. #
  55. # The following target appears first as a default
  56. #
  57. notarget: check_machine
  58.  
  59. #
  60. # The following targets will be invoked from above with MAKEPUBLIC=TRUE
  61. #
  62. obj: ${OBJ}
  63.     -mkdir ../OBJtemp
  64.     if [ "x${OBJ}" != x ]; then \
  65.         for obj in ${OBJ} END; do \
  66.             if [ $$obj != END ]; then \
  67.                 ln $$obj ../OBJtemp/$$obj; \
  68.                 fi; \
  69.             done ; \
  70.         echo "    ${VERSION_STRING_NAME}[]," \
  71.             >> ../OBJtemp/version_string_names ; \
  72.         echo "    &${VERSION_STRING_NAME}[0]," \
  73.             >> ../OBJtemp/version_string_addresses ; \
  74.         fi
  75.  
  76. lib: ${LIB}
  77.     -mkdir ../LIB/${CONFIG_DIR}
  78.     for file in ${LIB} END; do \
  79.         if [ $$file != END ]; then \
  80.             cp -p $$file ../LIB/${CONFIG_DIR}; \
  81.             fi; \
  82.         done
  83.  
  84. liba: ${LIBA}
  85.     -mkdir ../LIBAtemp
  86.     for file in ${LIBA} END; do \
  87.         if [ $$file != END ]; then \
  88.             ln $$file ../LIBAtemp/$$file; \
  89.             fi; \
  90.         done
  91.  
  92. bin: ${BIN}
  93.     -mkdir ../BIN/${CONFIG_DIR}
  94.     for file in ${BIN} END; do \
  95.         if [ $$file != END ]; then \
  96.             mv $$file ../BIN/${CONFIG_DIR}; \
  97.             fi; \
  98.         done
  99.  
  100. src:
  101.     -mkdir ../SRC
  102.     for file in `(ls *.c *.s 2> /dev/null)` END; do \
  103.         if [ $$file != END ]; then \
  104.             rm -f ../SRC/$$file; ln $$file ../SRC/$$file; \
  105.             fi; \
  106.         done
  107.  
  108. include:
  109.     -mkdir ../INCLUDE/xr
  110.     for file in ${INCLUDE} END; do \
  111.         if [ $$file != END ]; then \
  112.             ${CPDIFF} -p INCLUDE/xr/$$file ../INCLUDE/xr/$$file; \
  113.             fi; \
  114.         done
  115.  
  116. man:
  117.     -mkdir ${MAN_DIR}
  118.     for file in ${MAN} END; do \
  119.         if [ $$file != END ]; then \
  120.             ${CPDIFF} -p $$file ${MAN_DIR}; \
  121.             fi; \
  122.         done
  123.  
  124. clean:
  125.     rm -f ${LIB} ${LIBA} ${OBJ} ${BIN} ${CLEANUPFILES} *.o *.a *.bak *~ core XrDBXInner
  126.  
  127. #
  128. # Automatic version numbering
  129. #
  130. ${VERSION_DOT_O}: ${VERSION_DOT_C}
  131.     ${CC} -c ${CFLAGS} ${VERSION_DOT_C}
  132.     rm -f ${VERSION_DOT_C}
  133.  
  134. ${VERSION_DOT_C}:
  135.     echo "char ${VERSION_STRING_NAME}[] = \"${VERSION} (${CONFIG})" \
  136.         `date` "\";" > ${VERSION_DOT_C}
  137.  
  138.  
  139. #
  140. # checkout / checkin
  141. #
  142. # These fail if not interleaved properly.
  143. #
  144. # Checkin can be done from either the old or new directory.
  145. #
  146. checkout:
  147.     mkdir ../${COMPONENT}.co
  148.     tar cf - . | (cd ../${COMPONENT}.co; tar xf -);
  149.  
  150. checkin:
  151.     mv ../${COMPONENT} ../${COMPONENT}.SAV
  152.     mkdir ../${COMPONENT}
  153.     (cd ../${COMPONENT}.co; tar cf - . ) | (cd ../${COMPONENT}; tar xf -)
  154.     rm -rf ../${COMPONENT}.SAV
  155.  
  156. #
  157. # Dependency construction
  158. #
  159. # NOTE: the makefile must include "# DO NOT DELETE THIS LINE" after the
  160. #   last target.  "make depend" will replace everything following that line
  161. #   by a newly-constructed list of dependencies.
  162. #
  163. depend: makefile.config ${MAKE_DEPEND_SRC}
  164.     if [ "x${MAKE_DEPEND_SRC}" != x ]; then \
  165.         rm -f makedep eddep ; \
  166.         ${CC} -M ${CFLAGS} ${MAKE_DEPEND_SRC} \
  167.             | sed -e '/:$$/d' > makedep ; \
  168.         echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep ; \
  169.         echo '$$r makedep' >>eddep ; \
  170.         echo 'w' >>eddep ; \
  171.         cp makefile makefile.bak ; \
  172.         ex - makefile < eddep ; \
  173.         fi
  174.     rm -f eddep makedep
  175.     touch depend
  176.     
  177. #
  178. # Internal consistency check for machine types
  179. #
  180. #   (Does this work on non-Sun?) 
  181. #
  182. check_machine:
  183.     @if [ ${MACHINE} != ${TARGET_MACH} ]; then \
  184.         echo "Compiling on wrong machine type (" ${TARGET_MACH} ")"; \
  185.         exit 1; \
  186.     fi
  187.  
  188. #
  189. # The following is intended to force complete recompilation when makefile.config
  190. #   changes.
  191. #
  192. # If anything in ${BIN}, ${LIB}, ${LIBA} or ${OBJ} is built with ld,
  193. #   (and this is almost certainly the case)
  194. #
  195. #   --> YOU WILL NEED TO ADD MORE DEPENDENCIES TO MAKE THIS WORK RIGHT <--.
  196. #
  197. ${BIN} ${LIB} ${LIBA} ${OBJ}: makefile.config
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.